<jsp:directive.page contentType="text/html;charset=UTF-8" />
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="../../WEB-INF/c.tld" prefix="c" %>

<div class="main">
	<div class="container">
		<h2 class="left"><bean:message key="envoicolis.mainTitle" /></h2>
		<form class="well form-inline right" style="width:500px;">
	    	<bean:message key="commande.NumCommande" /> :
		    <input type="text" class="input-small" name="recherche" value="${commande.numeroCommande}">
		    <button type="submit" class="btn btn-success"><bean:message key="general.rechercher" /></button>
	    </form>
	    

		
		<c:if test="${commande != null }" >
		<table class="tableCommande">
			<thead>
			</thead>
			<tbody>
				<tr>
					<td class="first"><bean:message key="envoicolis.coordonnees" /></td>
					<td colspan="3" class="borderTop borderLeft borderRight" style="width:600px;">
						${commande.client.civiliteLongue } ${commande.client.prenom } ${commande.client.nom }<br/>
						${commande.client.adresse.adresse }<br/>
						${commande.client.adresse.complementsAdresse }<br/>
						${commande.client.adresse.codePostal } ${commande.client.adresse.ville }					
					</td>
				</tr>
				<tr>
					<td class="first">Article</td>
					<td colspan="3" class="borderLeft borderRight">
						<div class="scrollable envoiColis">
						<table class="table table-striped">
							<thead>
								<tr>
									<th><bean:message key="article.RefArticle" /></th>
									<th><bean:message key="article.Modele" /></th>
									<th><bean:message key="article.Quantite" /></th>
									<th colspan="2"><bean:message key="article.DescriptionCourte" /></th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${commande.listeArticle}" var="ligne">
								<tr>
									<td>${ligne.article.referenceArticle }</td>
									<td>${ligne.article.modele }</td>
									<td>${ligne.quantite}</td>
									<td>${ligne.article.descriptionCourte}</td>
								</tr>
								</c:forEach>
							</tbody>
						</table>
						</div>
					</td>
				</tr>
				<tr>
					<td class="first"><bean:message key="envoicolis.modeLivraison" /></td>
					<td colspan="3" class="borderBottom borderLeft borderRight">
						<table>
							<tbody>
								<tr>
									<td style="width:200px; vertical-align: top;">${commande.modeLivraison.libelle } : ${commande.relai.numeroRelai }</td>
									<td>
										<c:if test="${commande.relai != null}">
											${commande.relai.nom }<br/>
										</c:if>
										${commande.adresse.adresse }<br/>
										${commande.adresse.complementsAdresse }<br/>
										${commande.adresse.codePostal } ${commande.adresse.ville }									
									</td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>
				<tr>
					<td class="first"><bean:message key="envoicolis.contreRemboursement" /></td>
					<td style="border:1px solid #DDDDDD; padding: 5px;">
						<c:if test="${commande.modeDePaiement.libelle == 'Contre-remboursement' }">
							Oui
						</c:if>
						<c:if test="${commande.modeDePaiement.libelle != 'Contre-remboursement' }">
						 	Non
						</c:if>
					</td>
					<td style="padding-right: 50px; text-align: right; width: 300px;">Prix total</td>
					<td style="border:1px solid #DDDDDD; padding: 5px;">${commande.montant } € TTC</td>
				</tr>
			</tbody>
    	</table>
    	<div class="linkCenter">
	    	<c:if test="${commande.statut == 'processing' }">
	    		<a class="btn btn-primary" href="<%= request.getContextPath() %>/envoyer-colis.do?id=${commande.idCommande}"><bean:message key="envoicolis.Envoyer" /></a>
	    	</c:if>
    	</div>
    	</c:if>
    	
    	<c:if test="${commande == null }">
	    	<div class="welcomeMessage">
				<bean:message key="envoicolis.saisir" />
			</div>
	    </c:if>
    	
	</div>
</div>